/*
 * IfInstruction.h
 *
 *  Created on: 28/dic/2010
 *      Author: computer
 */

#ifndef IFINSTRUCTION_H_
#define IFINSTRUCTION_H_
#include "Expression.h"
#include "FlowExpression.h"

namespace TreeExpression {

class IfInstruction : public FlowExpression, public Expression_CRTP<IfInstruction> {
public:
	IfInstruction();
	IfInstruction(const IfInstruction&);
	~IfInstruction();

	void setCondition(const AutoPointer<Expression>&);
	void addInstruction(const AutoPointer<Expression>&);

	Expression* clone() const;

	virtual AutoPointer<Expression> eval(CopyPointer<Context>&);
	virtual std::string toString() const;

	virtual bool isStop() const;
	virtual bool isExecuted() const;
private:
	bool stop;
	bool executed;
	AutoPointer<Expression> condition;
	std::list< AutoPointer<Expression> > listInstruction;
};

}


#endif /* IFINSTRUCTION_H_ */
